import random
import socket

address = ('127.0.0.1', 8001)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

total = 100
data = b'12345678901234567890'
for i in range(total):
    n = random.randint(5, 20)
    s.sendto(data[:n], address)
    print('#%s, sent %s bytes' % (i, n))

s.close()
print('sent %s datagram' % total)
